Xbasic

ASC Function

Syntax

ASCII_Value as N = ASC(C character[,L unsigned])

Arguments

character

A character string.

unsigned

Logical. Optional. Default = .F. and .T. = Return a positive number for high-order characters, .F. = Return a negative number for high-order characters.

Description

Returns the ASCII value of a character.

Discussion

ASC() returns the integer ASCII_Value of the first letter in the specified Character_String. The inverse function of ASC() is CHR().

Example

dim FIRSTNAME as C
FIRSTNAME = "Borg"
? asc(FIRSTNAME)
= 66
? asc( chr(67) )
= 67
? asc("N")
= 78
? asc( chr(252) )
= -4
? asc(chr(252), .t.)
= 252

See Also